<style>
	.loader{
		position:fixed;
		top:0;
		left:0;
		background:rgba(255,255,255,0.8) url('<?php echo base_url("images/loading.gif");?>') no-repeat 50%;
		height:100%;
		width:100%;
		z-index:900;
		overflow:hidden;
	}
</style>
<?php
echo form_open(base_url("admin/adlegalisir/lihatPersetujuan/" . $id),array("id"=>"form-cetak"));
?>
<?php if($row != NULL){?>
<div class="row">
	<div class="col-sm-6">
		<section class="panel bs-example form-horizontal">
		<header class="bg-info panel-heading font-bold" style="background-color:#6c0a00">Biodata</header>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-sm-4 control-label">Nama lengkap</label>
					<div class="col-sm-7">
						<input type="text" class="form-control" data-required="true" value="<?php echo $row["NAMA_LENGKAP"]; ?>" disabled>
						<input type="hidden" class="form-control" data-required="true" name="nama_lengkap" value="<?php echo $row["NAMA_LENGKAP"]; ?>">
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-4 control-label">Tempat lahir</label>
					<div class="col-sm-7">
						<input type="text" class="form-control" data-required="true" value="<?php echo $row["TEMPAT_LAHIR"]; ?>" disabled>
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-4 control-label">Tanggal lahir</label>
					<div class="col-sm-7">
						<input class="datepicker-input form-control" data-required="true" type="text" data-date-format="dd-mm-yyyy" value="<?php echo $row["TGL_LAHIR"]; ?>" disabled>
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-4 control-label">Jenis kelamin</label>
					<div class="col-sm-7">
						<input type="text" class="form-control" data-required="true" value="<?php echo ($row["JENIS_KELAMIN"] == 1) ? ("Laki - Laki") : ("Perempuan"); ?>" disabled>
						<input type="hidden" class="form-control" data-required="true" name="jenkel" value="<?php echo ($row["JENIS_KELAMIN"] == 1) ? ("Laki - Laki") : ("Perempuan"); ?>">
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-4 control-label">Alamat</label>
					<div class="col-sm-7">
						<textarea class="form-control" disabled><?php echo $row["ALAMAT"]; ?></textarea>
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-4 control-label">Nomor telepon</label>
					<div class="col-sm-7">
						<input type="text" class="form-control" data-required="true" value="<?php echo $row["TELP"]; ?>" disabled>
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-4 control-label">Nomor handphone</label>
					<div class="col-sm-7">
						<input type="text" class="form-control" data-required="true" value="<?php echo $row["HP"]; ?>" disabled>
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-4 control-label">Email</label>
					<div class="col-sm-7">
						<input type="email" class="form-control" data-required="true" value="<?php echo $row["EMAIL"]; ?>" disabled>
						<input type="hidden" class="form-control" name="email" data-required="true" value="<?php echo $row["EMAIL"]; ?>">
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<div class="col-sm-11 control-label">
						<a class="btn btn-info" target="_blank" href="<?php echo base_url($row["ALAMAT_KTP"]);?>"><i class="fa fa-file text"></i><span class="text"> KTP</span></a>
					</div>
				</div>
			</div>
		</section>
	</div>
	<div class="col-sm-6">
		<section class="panel bs-example form-horizontal">
		<header class="bg-info panel-heading font-bold" style="background-color:#6c0a00">Permohonan Legalisir</header>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-sm-4 control-label">Tanggal permohonan</label>
					<div class="col-sm-7">
						<input class="form-control" data-required="true" type="text" data-date-format="dd-mm-yyyy" value="<?php echo $row["TGL_PENGAJUAN"]; ?>" disabled>
					</div>
				</div>
				<?php
				if($row["LEMBAR_TK1"] != "" && $row["LEMBAR_TK1"] != null && $row["LEMBAR_TK1"] != 0){
				?>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-4 control-label">Nama SD/PAKET A</label>
					<div class="col-sm-7">
						<input type="text" class="form-control" data-required="true" value="<?php echo $row["TK1"]; ?>" disabled>
					</div>
				</div>							
				<div class="form-group">
					<label class="col-sm-4 control-label">Jumlah legalisir</label>
					<div class="col-sm-3">
						<input type="text" class="form-control" data-required="true" value="<?php echo $row["LEMBAR_TK1"]; ?>" disabled>
					</div>
					<div class="col-sm-4">
						<?php if(is_null($row["TGL_CETAK"])){?><a class="btn btn-info cetak" data-toggle="modal" value="1"><i class="fa fa-file text"></i><span class="text"> Cetak</span></a><?php } ?>
						<a class="btn btn-info" href="#ajax-A" data-toggle="modal"><i class="fa fa-file text"></i><span class="text"> Ijazah</span></a>
					</div>							
				</div>
				<!--Tempat Ijazah-->
				<div class="modal" id="ajax-A">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal">&times;</button>
							<h4 class="modal-title">File Ijazah</h4>
						</div>
						<div class="modal-body">
							<img width="600" height="900" src="<?php echo base_url($row["ALAMAT_TK1"]);?>">
						</div>
						<div class="modal-footer">
							<a href="#" class="btn btn-white" data-dismiss="modal">Close</a>
							<a href="#" class="btn btn-primary">Save</a>
						</div>
					</div>
				</div>
				<!-- End -->
				<?php
				}
				if($row["LEMBAR_TK2"] != "" && $row["LEMBAR_TK2"] != null && $row["LEMBAR_TK2"] != 0){
				?>

				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-4 control-label">Nama SMP/PAKET B</label>
					<div class="col-sm-7">
						<input type="text" class="form-control" data-required="true"value="<?php echo $row["TK2"]; ?>" disabled>
					</div>
				</div>												
				<div class="form-group">
					<label class="col-sm-4 control-label">Jumlah legalisir</label>
					<div class="col-sm-3">
						<input type="text" class="form-control" data-required="true" value="<?php echo $row["LEMBAR_TK2"]; ?>" disabled>
					</div>
					<div class="col-sm-4">
						<?php if(is_null($row["TGL_CETAK2"])){?><a class="btn btn-info cetak" value="2" data-toggle="modal"><i class="fa fa-file text"></i><span class="text"> Cetak</span></a><?php } ?>
						<a class="btn btn-info" href="#ajax-B" data-toggle="modal"><i class="fa fa-file text"></i><span class="text"> Ijazah</span></a>
					</div>							
				</div>
				<!--Tempat Ijazah-->
				<div class="modal" id="ajax-B">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal">&times;</button>
							<h4 class="modal-title">Form Tanda Tangan</h4>
						</div>
						<div class="modal-body">
							<img width="600" height="900" src="<?php echo base_url($row["ALAMAT_TK2"]);?>">
						</div>
						<div class="modal-footer">
							<a href="#" class="btn btn-white" data-dismiss="modal">Close</a>
							<a href="#" class="btn btn-primary">Save</a>
						</div>
					</div>
				</div>
				<!-- End -->
				<?php
				}
				if($row["LEMBAR_TK3"] != "" && $row["LEMBAR_TK3"] != null && $row["LEMBAR_TK3"] != 0){
				?>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-4 control-label">Nama SMA/PAKET C</label>
					<div class="col-sm-7">
						<input type="text" class="form-control" data-required="true"value="<?php echo $row["TK3"]; ?>" disabled>
					</div>
				</div>												
				<div class="form-group">
					<label class="col-sm-4 control-label">Jumlah legalisir</label>
					<div class="col-sm-3">
						<input type="text" class="form-control" data-required="true" value="<?php echo $row["LEMBAR_TK3"]; ?>" disabled>
					</div>
					<div class="col-sm-4">
						<?php if(is_null($row["TGL_CETAK3"])){?><a class="btn btn-info cetak" value="3" data-toggle="modal"><i class="fa fa-file text"></i><span class="text"> Cetak</span></a><?php } ?>
						<a class="btn btn-info" href="#ajax-C" data-toggle="modal"><i class="fa fa-file text"></i><span class="text"> Ijazah</span></a>
					</div>							
				</div>
				<!--Tempat Ijazah-->
				<div class="modal" id="ajax-C">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal">&times;</button>
							<h4 class="modal-title">Form Tanda Tangan</h4>
						</div>
						<div class="modal-body">
							<img width="600" height="900" src="<?php echo base_url($row["ALAMAT_TK3"]);?>">
						</div>
						<div class="modal-footer">
							<a href="#" class="btn btn-white" data-dismiss="modal">Close</a>
						</div>
					</div>
				</div>
				<!-- End -->
				<?php
				}
				?>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-4 control-label">Alasan pengajuan</label>
					<div class="col-sm-7">
						<textarea class="form-control" rows="3" data-minwords="6" data-required="true" placeholder="Type your message" disabled><?php echo $row["ALASAN"]; ?></textarea>
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-4 control-label">Penanda tangan</label>
					<div class="col-sm-7">
						<input type="text" class="form-control" data-required="true" value="Kepala Dinas" disabled>
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-4 control-label">Status</label>
					<div class="col-sm-7">
						<input type="text" class="form-control" data-required="true" value="Terverifikasi" disabled>
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<?php
				if($this->session->userdata("role") == 4){
				?>
				<div class="form-group">
					<label class="col-sm-4 control-label">Keterangan Pengambilan</label>
					<div class="col-sm-7">
						<textarea class="form-control" name="ket" rows="3" data-minwords="6" data-required="true" placeholder="Type your message"><?php echo $row["KETERANGAN"]; ?></textarea>
					</div>
				</div>
				<?php
				}
				?>
				<div class="form-group">	
					<label class="col-sm-4 control-label"></label>
					<div class="col-sm-7">
						<div class="doc-buttons">
							<button class="btn btn-sm btn-warning btn-rounded" type="submit"><i class="fa fa-print text"></i><span class="text"> Simpan</span></button>								
							<a href="<?php echo site_url('admin/adlegalisir/persetujuan');?>" class="btn btn-sm btn-warning btn-rounded"><i class="fa fa-arrow-circle-left text"></i><span class="text"> Kembali</span></a>								
						</div>
					</div>				
				</div>
				<!--<div class="form-group">			
				<div class="col-lg-11 control-label">
				<div class="doc-buttons">
				<a href="<?//php echo site_url('admin/adlegalisir/persetujuan');?>" class="btn btn-sm btn-info"><i class="fa fa-arrow-circle-left text"></i><span class="text"> Kembali</span></a>
				<a href="<?//php echo site_url('admin/adlegalisir/persetujuan');?>" class="btn btn-sm btn-info"><i class="fa fa-thumbs-o-up text"></i><span class="text"> Telah dicetak</span></a>
				<a href="<?//php echo site_url('admin/adlegalisir/persetujuan');?>" class="btn btn-sm btn-info"><i class="fa fa-thumbs-o-up text"></i><span class="text"> Telah diambil</span></a>
				</div>
				</div>				
				</div>-->						
			</div>
		</section>
	</div>
</div>
<?php }else{
	$this->load->view("403_page");
 }?>
<?php echo form_close(); ?>
<script language="javascript">
	var res	= {
				loader:$('<div />', {class: 'loader'}),
				maincol: $('body')
			}
	$(".cetak").click(function(){
		var r = confirm("Anda yakin untuk mencetak legalisir ini ?");
		if(r == true){
			$(this).remove();
			var	jenis = $(this).attr("value");
			$.ajax({
			   type: "POST",
			   // data: id,
			   url:"<?php echo base_url("admin/adlegalisir/sudah_dicetak/" . $id);?>/" + jenis,
			   beforeSend:function(){
				res.maincol.append(res.loader);
			   },
			   success: function(data)
			   {
				   if(data == "sending"){
					$.ajax({
					   type: "POST",
					   url:"http://yeavirtual.com/index.php/mapi/announce_cetak",
					   data:$("#form-cetak").serialize(),
					   async:false,
					   success: function(data)
					   {	
							res.maincol.find(res.loader).remove();
							
							var url = "<?php echo base_url("admin/adlegalisir/v_image/" . $id);?>/" + jenis;
							window.open(url, '_blank');
					   },
					   error : function(data){
							res.maincol.find(res.loader).remove();
							
							var url = "<?php echo base_url("admin/adlegalisir/v_image/" . $id);?>/" + jenis;
							window.open(url, '_blank');
					   }
					});
				   } else {
					var url = "<?php echo base_url("admin/adlegalisir/v_image/" . $id);?>/" + jenis;
					window.open(url, '_blank');
					res.maincol.find(res.loader).remove();
				   }
			   },
			   error : function(){
					alert("Proses cetak gagal. Silahkan hubungi administrator.");
			   }
			
			});
		}
	});
</script>